<template>
	<view class="content">
		<view class='top' :style="{backgroundImage:'url('+imgurl+'topbanner.png'+')'}">
			<view :style="{paddingTop: systemBarHeight + 'px'}" ></view>
			<image class='logo' src="/static/images/logo.png"></image>
			<text class='title'>欢迎来到人创环保科技</text>
		</view>
		<view class='login-info'>
			<iconInput v-for="(item,index) in iconInputList" :iconsrc="item.iconsrc"
				:placeholdertext="item.placeholdertext" :isgetcode='item.isgetcode' :ref='item.name'></iconInput>
			<view class='forgot-password'>
				<text @click="forgotpassword()">忘记密码?</text>
			</view>
		</view>
		<view class='bottom-button'>
			<view class='login' @click="login()">
				登录
			</view>
			<view class='register' @click="register()">
				注册
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgurl:getApp().globalData.imgurl,
				iconInputList: [{
						name: 'phone',
						iconsrc: getApp().globalData.imgurl+'phone.png',
						placeholdertext: '请输入手机号',
						isgetcode: false
					},
					{
						name: 'password',
						iconsrc:getApp().globalData.imgurl+'password.png',
						placeholdertext: '请输入密码',
						isgetcode: false
					},
					{
						name: 'code',
						iconsrc: getApp().globalData.imgurl+'code.png',
						placeholdertext: '请输入验证码',
						isgetcode: true
					}
				],
				// 状态栏高度
				systemBarHeight: 0
			}
		},
		onLoad() {
			this.getSysteminfo();
		},
		methods: {
			forgotpassword(){
				uni.navigateTo({
					url: '/pages/forgotpassword/index'
				})
			},
			register(){
				uni.navigateTo({
					url: '/pages/register/index'
				})
			},
			login(){
				uni.switchTab({
					url: '/pages/index/index'
				}) 
			},
			// 获取系统栏高度
			getSysteminfo() {
				uni.getSystemInfo({
					success: res => {
						this.systemBarHeight = res.statusBarHeight;
						
					}
				});
			}
		}
	}
</script>

<style lang='less' scoped>
	.content {
		width: 100vw;
		height: 100vh;
		position: relative;
		.top {
			width: 100%;
			height: 450rpx;
			background-image: url('/static/images/topbanner.png');
			background-size: 100% 100%;
			padding-top: 1px;
			box-sizing: border-box;

			.logo {
				display: block;
				margin: 0px auto;
				margin-top: 128rpx;
				width: 77rpx;
				height:86rpx;
			}

			.title {
				display: block;
				font-size: 42rpx;
				color: #fff;
				text-align: center;
				margin-top: 41rpx;
				font-weight: 400;
			}
		}

		.login-info {
			width: 684rpx;
			margin: 0px auto;
			margin-top: 23rpx;

			.forgot-password {
				display: flex;
				justify-content: flex-end;
				margin-top: 40rpx;

				text {
					color: #666666;
					font-size: 24rpx;
				}
			}
		}

		.bottom-button {
			width: 684rpx;
			line-height: 80rpx;
			margin: 0px auto;
			position: absolute;
			bottom: 75rpx;
			left: 50%;
			transform: translateX(-50%);

			.login {
				background-color: #2F70F1;
				border-radius: 40rpx;
				color: #fff;
				text-align: center;
				;
			}

			.register {
				margin-top: 30rpx;
				color: #2F70F1;
				text-align: center;
				;
			}
		}
	}
</style>
